package org.i1510.common.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author rambo
 * http://127.0.0.1:8099/i1510_v1/common/login.jsp等同于
 * http://127.0.0.1:8099/i1510_v1/common/login/index.jsp
 */
public class RedirectServlet2 extends HttpServlet {
    
    public void init() {
    	
    }
    
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {

		String requestUri = req.getRequestURI();
//    	String requestUrl = requestUri.replace(req.getContextPath(), "");
    	resp.sendRedirect(requestUri.replace(".in", "/index.jsp"));
    }

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doGet(req, resp);
	}
    
}